package com.lzx.iteam.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

/**
 * 当大小发生变化时会产生回掉的LinerLayout,用于监听软键盘的弹出和隐藏
 * Created by liukun on 14-12-29.
 */
public class ResizeLinerLayout extends LinearLayout {
    private OnResizeListener mListener;

    public interface OnResizeListener {
        void onResize(int w, int h, int oldw, int oldh);
    }

    public void setOnResizeListener(OnResizeListener listener){
        mListener = listener;
    }

    public ResizeLinerLayout(Context context, AttributeSet attrs) {
        super(context,attrs);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        if(mListener != null){
            mListener.onResize(w,h,oldw,oldh);
        }
    }
}
